import request from '@/utils/request'

// loginparams的类型约束
export interface LoginParamsData{
  username:string,
  password:string
}
export interface LoginResponseData{
  token:string
}

export interface GetUserInfoResponseData{
  routes:string[],
  buttons:string[],
  roles:string[],
  name:string,
  avatar:string
}

export default {
//  GET /admin/acl/index/info
  // 获取用户信息
  getUserInfo(){
    return request.get<any,GetUserInfoResponseData>('/admin/acl/index/info')
  },

// POST /admin/acl/index/login
  // 登录并获取用户的token
  login(loginparams:LoginParamsData){
    return request.post<any,LoginResponseData>('/admin/acl/index/login',loginparams)
  },

// POST /admin/acl/index/logout
  // 退出登录
  logout(){
    return request.post<any,null>('/admin/acl/index/logout')
  }

}